<template>
	<view class="paydetail">
		<view class="list" v-if="type==0">
			<view class="list_item">
				<view class="list_title">审核状态</view>
				<view>{{ysfinfodata.statusText}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">失败原因</view>
				<view>{{ysfinfodata.reason}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">商户UID</view>
				<view>{{ysfinfodata.uid}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">商户名称</view>
				<view>{{ysfinfodata.shop_name}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">门店ID</view>
				<view>{{ysfinfodata.suid}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">提交人</view>
				<view>{{ysfinfodata.imgm_submit_username}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">提交时间</view>
				<view>{{ysfinfodata.imgm_submit_time}}</view>
			</view>
		</view>
		<view class="list" v-if="type==1">
			<view class="list_item">
				<view class="list_title">商户UID</view>
				<view>{{ysfinfodata.uid}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">门店名称</view>
				<view>{{ysfinfodata.shop_name}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">门店ID</view>
				<view>{{ysfinfodata.suid}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">提交人</view>
				<view>{{ysfinfodata.imgm_submit_username}}</view>
			</view>
			<view class="list_item">
				<view class="list_title">提交时间</view>
				<view>{{ysfinfodata.imgm_submit_time}}</view>
			</view>
		</view>
		<view class="photo" v-if="type==0">
			<view class="photo_item">
				<image :src="ysfinfodata.img_shop"></image>
				<view><text class="redfont">*</text>门头照(带商户店名)</view>
			</view>
			<view class="photo_item">
				<image :src="ysfinfodata.img_checkstand"></image>
				<view><text class="redfont">*</text>收银台照(带银联云闪付logo)</view>
			</view>
			<view class="photo_item">
				<image :src="ysfinfodata.img_environment"></image>
				<view><text class="redfont">*</text>店内环境照</view>
			</view>
			<view class="photo_item">
				<image :src="ysfinfodata.img_device"></image>
				<view>硬件设备照(带银联云闪付logo)</view>
			</view>
		</view>
		<view class="photo" v-if="type==1">
			<view class="photo_item">
				<image :src="ysfinfodata.img_materials"></image>
				<view>物料</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { ysfinfo } from '../../api/index.js'
	export default {
		data() {
			return {
				type:0,//type 0为银联云闪付 1为云闪付物料
				ysfinfodata:{
					uid:'',
					shop_name:'',
					suid:'',
					salesman_id:'',
					imgm_submit_time:'',
					img_materials:'',
					status:'',
					statusText:'',
					imgm_submit_username:'',//物料照
					img_environment:'',//店内环境照
					img_shop:'',//门头照
					img_checkstand:'',//收银台照
					img_device:''//硬件设备照
				}
			}
		},
		onLoad:function(data){
			console.log(data.id)
			this.type = data.type;
			if(data.type == 1){ //type 0为银联云闪付 1为云闪付物料
				uni.setNavigationBarTitle({
				    title: '云闪付物料详情'
				});
			}else{
				uni.setNavigationBarTitle({
				    title: '银联云闪付详情'
				});
			}
			this.getYsfinfo(data.id)
		},
		methods: {
			getYsfinfo(id){
				let that = this;
				ysfinfo({id:id}).then((res) => {
					console.log(res)
					if(res.code == 0){
						let statusTextObj = {
							'-1':'未申请',
							'0':'未审核',
							'1':'审核通过',
							'2':'审核失败'
						}
						that.ysfinfodata = res.data;
						that.ysfinfodata.statusText = statusTextObj[res.data.status];
						
						// that.ysfinfodata.uid = res.data.uid;
						// that.ysfinfodata.shop_name = res.data.shop_name;
						// that.ysfinfodata.suid = res.data.suid;
						// that.ysfinfodata.imgm_submit_username = res.data.imgm_submit_username;
						// that.ysfinfodata.salesman_id = res.data.salesman_id;
						// that.ysfinfodata.imgm_submit_time = res.data.imgm_submit_time;
						// that.ysfinfodata.status = res.data.status;
						// that.ysfinfodata.statusText = statusTextObj[res.data.status];
						// that.ysfinfodata.img_materials = res.data.img_materials;
						// that.ysfinfodata.img_environment = res.data.img_environment;
						// that.ysfinfodata.img_shop = res.data.img_shop;
						// that.ysfinfodata.img_checkstand = img_checkstand;
						// that.ysfinfodata.img_device = res.data.img_device;
					}
				}).catch((e) => {
					console.log(e)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.paydetail{
		font-size: $uni-font-size-base;
		padding: 0 30rpx;
		.list{
			margin-bottom: 30rpx;
			.list_item{
				display: flex;
				align-items: center;
				border-bottom: 1rpx solid $uni-border-color-e5;
				height: 100rpx;
				justify-content: space-between;
				.list_title{
					width: 30%;
					color: #666666;
				}
				input{
					font-size: $uni-font-size-base;
					width: 70%;
				}
			}
		}
		.photo{
			display: flex;
			flex-wrap: wrap;
			.photo_item{
				width: 50%;
				text-align: center;
				color: #666666;
				image{
					width: 340rpx;
					height: 240rpx;
				}
			}
		}
	}
</style>
